package check;

import java.util.ArrayList;
import java.util.List;

import models.action.Action;

public class ActionAnalyser {

    public static List<String> findAgentEditableStates(List<Action> actions) {
        List<String> statesChangeable = new ArrayList<String>();
        if(actions != null) {
            for(Action action : actions) {
                for(String pre : action.getPreCondition()) {
                    for(String post : action.getPostCondition()) {
                        if(("~" + pre).equalsIgnoreCase(post) || ("~" + post).equalsIgnoreCase(pre)) {
                            statesChangeable.add(pre);
                            statesChangeable.add(post);
                        }
                    }
                }
            }
        }
        System.out.println("Agent Changeable State:" + statesChangeable);
        return statesChangeable;
    }
}
